package com.fp.m7.util;

import java.util.Date;

import com.fp.m7.api.util.Clock;

public class MockClock implements Clock {

	private long begin;
	private long end;
	private double step;

	public Date getDate() {
		return new Date(begin + (long) step);
	}

	@Override
	public Long getDateAsLong() {
		return getDate().getTime();
	}

	public void configure(Date begin, Date end, int maxEventCount) {
		this.begin = begin.getTime();
		this.end = end.getTime();

		if (maxEventCount == 0) {
			this.step = 0;
		} else {
			this.step = (this.end - this.begin) / maxEventCount;
		}
	}

}
